//导入vue-router
import VueRouter from 'vue-router'
import Vue from 'vue'
// 注册
Vue.use(VueRouter)
//导入
import Hero from './views/hero'
import Zb from './views/zb'
import Jn from './views/jn'
import HeroAdd from './views/hero-add'
import HeroEdit from './views/hero-edit'
//路由规则
const routes = [{
        path: '/',
        redirect: '/hero'
    },
    {
        path: '/hero',
        component: Hero
    },
    {
        path: '/hero/add',
        component: HeroAdd
    },
    {
        path: '/zb',
        component: Zb
    },
    {
        path: '/jn',
        component: Jn
    },

    {
        path: '/hero/edit/:id',
        component: HeroEdit
    }
]
//初始化router
const router = new VueRouter({
    routes,
    linkActiveClass: 'active'
})
export default router